'use strict';
import React, {
    Component
} from 'react'
import {
    Link,
    hashHistory
} from 'react-router'
import {
    goJxtUrl
} from '../Tool'
import Header from './Common/Header'
import score from '../img/icon/score_index.png'
import growthRecord from '../img/icon/growthRecord_index.png'
import subjectTimetable from '../img/icon/subjectTimetable_index.png'
import leaveList from '../img/icon/leaveList_index.png'
import classAlbum from '../img/icon/classAlbum_index.png'
import phoneDirectories from '../img/icon/phoneDirectories_index.png'

export default class Index extends Component {
    constructor(props) {
        super(props);
    }

    jxtLink(url) {
        const data = `wherefrom=weixin&appToken=${localStorage.appToken}&appType=${[2, 3, 1][this.props.params.type - 1]}&phone=${localStorage.userphone}`
        location.href = goJxtUrl + '/jiaxiaotong/#' + url + '?' + data;
    }

    /**
     * 退出登录——教师
     */
    teacherCancel() {
        hashHistory.push(`/login/0/jxt/${localStorage.appToken}`)
    }
    render() {
        const {
            type,
            integral
        } = this.props.params
        return (
            <div className="index_page bgc-white ptop" >
                <Header title='更多'/>
                <ul className='indexlist clearfix posistatic'>
                    <li className='index'>
                        <div onClick={this.jxtLink.bind(this,'/PhoneDirectories')}>
                            <img src={phoneDirectories}/>
                            <span>通讯录</span>
                        </div>
                    </li>
                    {type==1?
                    <li className='index'>
                        <div onClick={this.jxtLink.bind(this,'/SubjectTimetable')}>
                            <img src={subjectTimetable}/>
                            <span>班级课表</span>
                        </div>
                    </li>:null}
                    <li className='index'>
                        <div onClick={this.jxtLink.bind(this,'/ClassAlbum')}>
                            <img src={classAlbum}/>
                            <span>班级相册</span>
                        </div>
                    </li>
                    <li className='index'>
                        <div onClick={this.jxtLink.bind(this,'/LeaveList')}>
                            <img src={leaveList}/>
                            <span>请假信息</span>
                        </div>
                    </li>
                    {integral==0?null:
                    <li className='index'>
                        <div onClick={this.jxtLink.bind(this,'/GrowthRecord')}>
                            <img src={growthRecord}/>
                            <span>成长记录</span>
                        </div>
                    </li>}
                </ul>
                <div className="cancellation" onClick={this.teacherCancel.bind(this)}>退出登录</div>
            </div>
        )
    }
}
